package com.wifi.game.service;

import com.wifi.game.dao.GameDaoImp;
import com.wifi.game.entity.GameEntity;

import java.sql.SQLException;
import java.util.List;

public class GameServiceImp implements GameService{
                        GameDaoImp gameDaoImp =new GameDaoImp();
    @Override
    public List<Object> findAll(int star,int pageNum) {
        try {
            List<Object> list = gameDaoImp.findAll(star,pageNum);
            if(list!=null){
                return  list;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public long count() {
        try {
            return gameDaoImp.count();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return 0;
    }

    @Override
    public void insert(GameEntity gameEntity) {
        try {
            gameDaoImp.insert(gameEntity);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    @Override
    public Object find(int gid) {
        try {
         return    gameDaoImp.find(gid);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public void edit(int gid, GameEntity gameEntity) {
        try {
            gameDaoImp.edit(gid,gameEntity);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void remove(int gid) {
        try {
            gameDaoImp.remove(gid);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }


}
